package com.rc.saas.tenant.service.fault;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.mapper.device.RcLabelMapper;
import com.rc.saas.tenant.mapper.fault.RcElecPileFaultMapper;
import com.rc.saas.tenant.model.device.RcLabel;
import com.rc.saas.tenant.model.device.RcLabelExample;
import com.rc.saas.tenant.model.fault.RcElecPileFault;
import com.rc.saas.tenant.model.fault.RcElecPileFaultExample;
import com.rc.saas.tenant.search.elec.ElecLabelSearch;
import com.rc.saas.tenant.search.fault.RcElecPileFaultSearch;
import com.rc.saas.tenant.service.elec.ElecLabelService;
import com.rc.saas.tenant.vo.fault.RcElecPileFaultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by sven on 2018-04-17
 */
@Service
public class RcElecPileFaultServiceImpl implements RcElecPileFaultService {

    @Autowired
    private RcElecPileFaultMapper rcElecPileFaultMapper;


    @Override
    public RcElecPileFaultMapper getMapper() {
        return rcElecPileFaultMapper;
    }


    @Override
    public PageInfo<RcElecPileFault> listPageByCondition(RcElecPileFaultSearch rcElecPileFaultSearch) {
        PageHelper.startPage(rcElecPileFaultSearch.getOffset(), rcElecPileFaultSearch.getLimit());
        List<RcElecPileFault> elecLabelList =  rcElecPileFaultMapper.listPageByCondition(rcElecPileFaultSearch);
        return new PageInfo<RcElecPileFault>(elecLabelList);
    }

    @Override
    public List<RcElecPileFault> loadRcElecPileFault() {
        RcElecPileFaultExample example = new RcElecPileFaultExample();
        List<RcElecPileFault> rcElecPileFaults = rcElecPileFaultMapper.selectByExample(example);
        return rcElecPileFaults;
    }

}
